<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="resign.css" type="text/css">
</head>
<body background="back.jpg">
<div class="container">
    <div class="welcome">
        <h1 class="person">用户注册</h1>
        <div class="index">
            <div class="login">
                <form action="${pageContext.request.contextPath}/RegisterServlet" method="post" onsubmit="return check()">

                    <input class="text"  type="text" id="Username" name="username" placeholder="账号"
                    ><br>

                    <input class="password" type="password" id="Password" name="password" placeholder="以字母开头只能包含字母、数字和下划线"
                    ><br>
                    <input  class="button1"  type="password" id="Password2" name="password2"  placeholder="确认密码">
                    <br>
                <a href="" target="_blank"><input type="submit" class="button2" value="注册"></a><br>
                    <span class="forge">${sta}</span>
                <span class="forge"><a href="index.jsp" target="_blank">已有账号，直接登录</a></span>
                </form>
            </div>
        </div>
    </div>
</div>
</body>
<script>


    function check() {
        var username = document.getElementById('Username').value
        var password = document.getElementById('Password').value
        var password2 = document.getElementById('Password2').value
        console.log(username)
        console.log(password)
        console.log(password2)
        if (username == "") {
            alert("账号不能为空")
            return false
        } else if (password == "") {
            alert("密码不能为空")
            return false
        } else if (password2 == "") {
            alert("确认密码不能为空")
            return false
        } else if (password != password2) {
            alert("两次密码不一致")
            return false
        } else {
            return true;
        }
    }

</script>
</html>
